package order

import (
	"huijing_mall/logic/orderlogic"
	ask "huijing_mall/shared/kernel/ask"
	"net/http"

	"github.com/gin-gonic/gin"
)

func CreateOrder(c *gin.Context) {
	// 定义一个结构体变量
	var req ask.OrderReq
	// 从请求体中解析 JSON 数据
	if err := c.ShouldBindJSON(&req); err != nil {
		// 如果解析失败，返回错误
		ask.Errors(c, http.StatusBadRequest, err)
		return
	}

	orderlogic.Orders(c, req)
	return
}
